using cframework_coroutineutil;
using System.Collections;
using UnityEngine;
public class TestCoroutineWithResult : MonoBehaviour
{
    public IEnumerator Test4()
    {
        yield return null; //停一帧
        yield return new WaitForSeconds(1); //停一秒
        yield return "hellow world!"; //返回值 hello world!
    }

    public IEnumerator Start()
    {
        var b = Test4().WithResult(); //调用WithResult使协程可通过yield return "hellow world!"停止协程的运行，并能以hello world!作为返回值
        yield return b; //异步等待返回值

        Debug.LogError("test4 result: " + b.Current); //这里输出协程返回值,是hello world!
    }
}